package com.campus.secondhand.entity;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Data;

/**
 * 用户位置实体类
 */
@Data
@Entity
@Table(name = "user_locations")
public class UserLocation {
    /**
     * 位置ID，主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 用户ID，关联users表
     */
    @Column(name = "user_id", nullable = false, unique = true)
    private Long userId;

    /**
     * 经度
     */
    @Column(nullable = false, precision = 10, scale = 6)
    private BigDecimal longitude;

    /**
     * 纬度
     */
    @Column(nullable = false, precision = 10, scale = 6)
    private BigDecimal latitude;

    /**
     * 最后更新时间
     */
    @Column(name = "last_updated", nullable = false)
    private LocalDateTime lastUpdated;
}